#!/bin/bash
pdftoppm -gray $1 ""
for i in *.pgm
do
 ppmnorm -wpercent $2 ./$i | sam2p -e:scale - PDF: ./`echo $i | tr -d "-" | tr -d ".pgm"`_.pdf 
 rm ./$i
done
pdftk *_.pdf output `echo $1 | tr -d '-' | tr -d ".pdf"`_contrast.pdf
rm *_.pdf
